package com.yf1706.service;

import java.util.Date;
import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import com.yf1706.bean.CheckComputeRule;
import com.yf1706.dao.jpa.ICheckComputeRuleJDAO;
import com.yf1706.dao.mybatis.ICheckComputeRuleMDAO;
@Service
@Transactional(rollbackFor=Exception.class)
public class CheckComputeRuleService {
	@Autowired
    private ICheckComputeRuleJDAO ccrJDao;
	@Autowired
	private ICheckComputeRuleMDAO ccrMdao;
	public List<CheckComputeRule> getComputeRulelist(){
		return ccrMdao.qureycheckComputeRuleList();
	}
	//新增考勤计算规则
	public void addComputeRule(CheckComputeRule ComputeRule) {
		ComputeRule.setMakeTime(new Date());
		ComputeRule.setState("是");
		ccrJDao.save(ComputeRule);
	}
	//更新考勤计算规则
	public void updateComputeRule(CheckComputeRule ComputeRule) {
		ComputeRule.setUpdateTime(new Date());
		ComputeRule.setState("是");
		ccrJDao.save(ComputeRule);
	}
	
	//更新考勤计算规则
	public void deletecomputeRule(int id) {
		ccrJDao.deleteById(id);
	}
	//更具名称进行模糊查询
	public List<CheckComputeRule> getSerchComputeRuleList(String computeName){
		return ccrMdao.qureyComputeRuleList(computeName);
	}
}
